package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Correcting;
import cn.wolfcode.crm.mapper.CorrectingMapper;
import cn.wolfcode.crm.query.StagingQueryObject;
import cn.wolfcode.crm.service.ICorrectingService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class CorrectingServiceImpl implements ICorrectingService {

    @Autowired
    CorrectingMapper correctingMapper;

    public PageResult query(StagingQueryObject qo) {
        int count = correctingMapper.query4Count(qo);
        if (count > 0) {
            return new PageResult(count, correctingMapper.query4List(qo));
        }
        return new PageResult(count, Collections.EMPTY_LIST);
    }

    public int deleteByPrimaryKey(Long id) {return correctingMapper.deleteByPrimaryKey(id);
    }

    public int insert(Correcting record) {

        return correctingMapper.insert(record);
    }

    public Correcting selectByPrimaryKey(Long id) {
        return correctingMapper.selectByPrimaryKey(id);
    }

    public List<Correcting> selectAll() {
        return correctingMapper.selectAll();
    }

    public int updateByPrimaryKey(Correcting record) {
        return correctingMapper.updateByPrimaryKey(record);
    }
}
